﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace SpriteSample
{
    class KeyInput
    {
        private KeyboardState m_lastkey,m_key;
        public KeyboardState KeyboardState
        {
            get { return m_key; }
        }
        public KeyboardState LastKeyboardState
        {
            get { return m_lastkey; }
        }
        public KeyInput()
        {
            m_key = Keyboard.GetState();
        }
        public void Update()
        {
            m_lastkey = m_key;
            m_key = Keyboard.GetState();
        }
        public bool IsPressed(Keys _key)
        {
            return m_lastkey.IsKeyUp(_key) && m_key.IsKeyDown(_key);
        }
        public bool IsReleased(Keys _key)
        {
            return m_lastkey.IsKeyDown(_key) && m_key.IsKeyUp(_key);
        }
        public bool IsDown(Keys _key)
        {
            return m_key.IsKeyDown(_key);
        }
        
    }
}
